package com.xiecong.controller;


import com.xiecong.pojo.ClazzOption;
import com.xiecong.pojo.JobOption;
import com.xiecong.pojo.Result;
import com.xiecong.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;


    /**
     * 员工职位数据统计
     * @return
     */
    @GetMapping("/empJobData")
    public Result empJobData(){
        log.info("员工职位数据统计");
        JobOption jobOption = reportService.empJobData();
        return Result.success(jobOption);
    }


    /**
     * 员工性别数据统计
     * @return
     */
    @GetMapping("/empGenderData")
    public Result genderData(){
        log.info("员工性别数据统计");
        List<Map<String, Object>> genders = reportService.genderData();
        return Result.success(genders);
    }


    /**
     * 班级人数统计
     * @return
     */
    @GetMapping("/studentCountData")
    public Result studentCount(){
        log.info("班级人数统计");
        ClazzOption studentCount = reportService.studentCount();
        return Result.success(studentCount);
    }


    /**
     * 学员学历统计
     */
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        log.info("学员学历统计");
        List<Map<String, Object>> degreeData = reportService.studentDegreeData();
        return Result.success(degreeData);
    }
}
